package com.atguigu.realtime.gmallsugar.mapper;

import com.atguigu.realtime.gmallsugar.bean.Kw;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @Author lzc
 * @Date 2022/4/26 14:37
 */
public interface KwMapper {

    @Select("SELECT\n" +
        "    keyword,\n" +
        "    sum(ct * multiIf(source = 'search', 10, source = 'click', 8, source = 'order', 5, 3)) AS score\n" +
        "FROM keyword_stats_2022\n" +
        "WHERE toYYYYMMDD(stt) = #{date}\n" +
        "GROUP BY keyword\n")
    List<Kw> kw(@Param("date") int date);  // 20220326
    


}
